/* -+- file  ./kf2/Events/Event.cs -+- */
/*
 * kf2 jabber client
 * ~~~~~~~~~~~~~~~~~
 *
 * Copyright (C) 2006-2007 Przemysław Sitek
 * 				<przemyslaw.sitek at wp.pl> 
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

using System;
using Habazie.kf2.Net;
using Habazie.kf2.GUI;	// For INotifyService
using Habazie.kf2.Roster;	// e

namespace Habazie.kf2.Events
{
	
	abstract public class Event
	{
		///<summary>Short description of this event class</summary>
		protected string m_EventName = "generic";
		
		///<summary>Event id</summary>
		protected static int m_NextId = 0;
		
		///<summary>Event source</summary>
		private Item m_source = null;
		
		private int m_Id;
		
		///<summary>Account</summary>
		private Account m_Account;
		
		public Event (Account source, jabber.protocol.Packet packet)
		{
			m_Id = m_NextId++;
			m_Account = source;
			
			jabber.JID jid = packet.From.Bare;
			Roster.Roster roster = source.GetRosterRef ();
			if (roster != null)
				m_source = roster.GetItem (jid);
		}
		
		
		public Account Source {
			get { return m_Account; }
		}
		
		
		/// <summary>
		/// 	Unique event identifier
		/// </summary>
		public int Id {
			get { return m_Id; }
		}
		
		
		/// <summary>
		/// 	Name of this event
		///	</summary>
		public string EventName {
			get { return m_EventName; }
		}
		
		
		/// <summary>
		/// 	Roster item that is source of this event
		///	</summary>
		public Item SourceItem {
			get { return m_source; }
		}
		
		
		///<summary>Display this event</summary>
		abstract public void Display ();
		
		///<summary>Notify user</summary>
		abstract public void Notify (INotifyService notify);
		
		
		///<summary>Get string representation of this event</summary>
		public override string ToString ()
		{
			return "";
		}
	}
}
